package ch4;

import java.util.Random;

/**
 * @author ANG.YU
 * @date 2020-08-09 19:52
 */
public class ArrayNew {
    static Random random = new Random();

    static int pRand(int mod) {
        return Math.abs(random.nextInt()) % mod + 1;
    }

    public static void main(String[] args) {
        int[] a;
        a = new int[pRand(20)];//随机长度的数组
        System.out.println("length of a = " + a.length);
        for (int i = 0; i < a.length; i++) {
            System.out.println("a[" + i + "] = " + a[i]);
        }
    }
}
